round
Round floating point numbers
round()
function rounds up floating point numbers.
<?php echo ( round ( 0.60 ) ) ; echo ( round ( 0.50 ) ) ; echo ( round ( 0.49 ) ) ; echo ( round ( - 4.40 ) ) ; echo ( round ( - 4.60 ) ) ; ?>
Try it yourself
round ( x , prec )
parameter | describe |
---|---|
x | Optional. Specify the number to be rounded. |
prec | Optional. Specify the number of digits after the decimal point. |
Returns the result of rounding x according to the specified precision prec (the number of numbers after decimal decimal points). prec can also be a negative number or zero (default value).